using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace GameSite.Models.Mapping
{
    public class ContactNoteMap : EntityTypeConfiguration<ContactNote>
    {
        public ContactNoteMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.ID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.Property(t => t.Title)
                .IsRequired()
                .HasMaxLength(100);

            this.Property(t => t.Content)
                .IsRequired()
                .HasMaxLength(1000);

            this.Property(t => t.CreateBy)
                .IsRequired()
                .HasMaxLength(100);

            this.Property(t => t.CreateTime)
                .IsRequired();

            this.Property(t => t.Mail)
                  .HasMaxLength(50);

            this.Property(t => t.ContactInfo)
             .HasMaxLength(150);

            // Table & Column Mappings
            this.ToTable("ContactNote");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.IsRead).HasColumnName("IsRead");
            this.Property(t => t.IsDone).HasColumnName("IsDone");
            this.Property(t => t.Title).HasColumnName("Title");
            this.Property(t => t.Content).HasColumnName("Content");
            this.Property(t => t.CreateBy).HasColumnName("CreateBy");
            this.Property(t => t.CreateTime).HasColumnName("CreateTime");
            this.Property(t => t.ReadTime).HasColumnName("ReadTime");
            this.Property(t => t.DoneTime).HasColumnName("DoneTime");
            this.Property(t => t.Mail).HasColumnName("Mail");
            this.Property(t => t.ContactInfo).HasColumnName("ContactInfo");
        }
    }
}
